<template>
  <div class="memberCenter">
    <div class="content">
      <!-- <div class="link1" @click="goToPage('link1')"></div>
      <div class="link2" @click="goToPage('link2')"></div> -->
      <div class="background">
        <img
          src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/cp/banner3.png"
          class="bg"
          @click="goToPage('orderPre')"
        />
        <!-- <img
          src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/tobuy1.png"
          class="buy_link"
        /> -->
        <!-- <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/416/banner0328.png" class="banner" @click="goToActive()" > -->
        <!-- <p></p>
        <p class="link">请阅读</p>
        <p class="link" @click="goToPage('link4')">《健康中国.一带一路.双百工程》介绍</p>
        <p class="link" @click="goToPage('link5')">“中国健康促进与教育协会”【2016】29号（文件）</p> -->
      </div>
    </div>
    <div class="footer-nav">
      <!-- <div>
        <ul @click="goToPage('history')">
          <li>
            <img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/history.png" />
          </li>
          <li>展望历史</li>
        </ul>
      </div> -->
      <div>
        <ul @click="goToPage('orderPreTest')">
          <li>
            <img
              src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/activities.png"
            />
          </li>
          <li>脂肪谱检测</li>
        </ul>
      </div>
      <div>
        <ul @click="goToPage('orderPre')">
          <li>
            <img
              src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/products.png"
            />
          </li>
          <li>产品中心</li>
        </ul>
      </div>
      <!-- <div>
        <ul @click="goToPage('sales')">
          <li><img src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/discount.png"></li>
          <li>拼团活动</li>
        </ul>
      </div> -->

      <div>
        <ul @click="goToPage('personalCenter')">
          <li>
            <img
              src="http://cdn.gee4.cn/zw-wx/wx-vue-img-v2/img/personal.png"
            />
          </li>
          <li>个人中心</li>
        </ul>
      </div>
    </div>
  </div>
</template>
<script>
import { addRcmInfo, addAdminCode } from "api/user";
import { mapGetters } from "vuex";
import { wxshare } from "common/mixin";
import { MessageBox } from "mint-ui";

import { getFlag, setFlag } from "service/auth";

export default {
  mixins: [wxshare],
  data() {
    return {
      test: "测试log", //
    };
  },
  computed: {
    ...mapGetters(["phone", "insiderName"]),
  },
  methods: {
    goToPage: function (page) {
      if (page == "personalCenter") {
        // if (!this.phone) {
        //   this.$router.push({ path: "editInfo" });
        // } else {
        //   this.$router.push({ path: "personalCenter" });
        // }
        this.$router.push({ path: "personalCenter" });
      } else if (page == "orderPre") {
        // if (!this.phone) {
        //   this.$router.push({ path: "editInfo" });
        // } else {
        //   this.$router.push({ path: "orderPre" });
        // }
        this.$router.push({ path: "orderPre" });
      } else {
        this.$router.push({ path: page });
      }
    },
    goToddk() {
      // if (this.insiderName) {
      //   location.href = 'https://shop13332109.wxrrd.com/feature/10356532';
      // } else {
      //   location.href = 'https://shop13325375.wxrrd.com/feature/10298983';
      // }
      location.href = "https://shop13325375.wxrrd.com/feature/10298983";
    },
    notice: function () {
      MessageBox.alert(
        "2018年4月起。展望生命保尔胶囊价格调整为398元/瓶为了提升保尔胶囊的有效吸收率，展望产品研发小组一直在不断研发，现推出欧米伽3含量高达90%的高纯度产品，更是严选进口无污染深海鱼，绿色安全更值得放心！一粒相当于原来的1.5粒，功效更好。                              针对价格调整后会员系统中的积分使用问题，如有疑问请联系客服：021-65750778  客服工作时间：9:00-17:00（周一至周五）",
        "温馨提示"
      );
    },
    addRcm: function () {
      if (this.$router.currentRoute.query.tpAdminCode) {
        addRcmInfo({
          tpAdminCode: this.$router.currentRoute.query.tpAdminCode,
          tpMacAddress: this.$router.currentRoute.query.mac,
        });
      }
      if (this.$router.currentRoute.query.code) {
        addRcmInfo({
          referrerCode: this.$router.currentRoute.query.code,
        });
      }
      if (this.$router.currentRoute.query.adminCode) {
        addAdminCode({
          adminCode: this.$router.currentRoute.query.adminCode,
        });
      }
    },
    goToActive() {
      this.$router.push({ path: "convention" });
    },
  },
  mounted() {
    // if (!getFlag()) {
    //   setFlag("1");
    //   this.notice();
    // }
    this.addRcm();
  },
};
</script>
<style lang="less" scoped>
@import "./index.less";
</style>
